package com.ocom.payconfig.config.datasource;

import com.alibaba.druid.pool.DruidDataSource;
import com.ocom.common.entity.master.EntityCompanyPart;

public class DataSourceDriver {

    /**
     * 创建一个DataSource的代理
     * @return
     */
    public static final DruidDataSource createConnection(EntityCompanyPart entityCompanyPart){
        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setUrl(entityCompanyPart.getDatabaseUrl());
        druidDataSource.setUsername(entityCompanyPart.getDatabaseUsername());
        druidDataSource.setPassword(entityCompanyPart.getDatabasePassword());
        return druidDataSource;
    }
}
